<!DOCTYPE html>
<html>

<head lang="en">
  <meta charset="UTF-8">
  <title>添加jQuery原型对象对象方法</title>
  <script src="js/jquery-1.11.3.js"></script>
</head>

<body>
  <ul>
    <li>85</li>
    <li>91</li>
    <li>73</li>
    <li>59</li>
  </ul>
  <script>
    //prototype == fn -->别名
    //创建 只能被jQuery使用的sum函数
    var $lis = $("ul li");
    console.log($lis);
    console.log($lis.__proto__ == jQuery.prototype);
    // jQuery.prototype.sum = function () {
    jQuery.fn.sum = function () {
      var sum = 0;
      console.log(this);
      this.each(function () {
        console.log($(this).html());
        sum += parseInt($(this).html());
      });
      return sum;
    }
    console.log($lis.sum());
  </script>
</body>

</html>